<template>
  <div>
    <p>当前正式版本号：1.1.9</p>
    <p>当前测试版本号：1.3.2</p>
    <p>{{showToken}}</p>
  </div>
</template>

<script>
import { GetRequest } from "@/utils";
import { getToken, setToken, removeToken } from "@/utils/auth";

export default {
  data() {
    return {
      showToken: "",
    };
  },
  created() {
    let code = GetRequest(window.location.href).code;
    console.log("code", code);
    if (code) {
      let urlCode = JSON.parse(decodeURIComponent(code));
      console.log("参数解码后", urlCode);
      if (urlCode.action == "setToken") {
        setToken(encodeURIComponent(urlCode.token));
        this.showToken = getToken();
        console.log("参数为setToken，设置新token:", this.showToken);
      } else {
        removeToken();
        this.showToken = getToken();
        console.log("参数为removeToken，清除token:", this.showToken);
      }
    } else {
      console.log("没有code参数");
    }
  },
  methods: {},
};
</script>

<style>
</style>